#!/usr/bin/perl
use Getopt::Std;
getopt("m:i:u:l", \%args); 
my $marker = $args{m};
my $input  = $args{i};
my $uplimit  = $args{u};
my $lowlimit  = $args{l};
chomp $marker;
chomp $input;
chomp $uplimit;
chomp $lowlimit;
if($marker eq "")
{
        die "entered markerfile name  is empty\n";

}
if($input eq "")
{
        die "entered input file name  is empty\n";

}
if($uplimit eq "")
{
        die "entered upper limit  is empty\n";

}
if($lowlimit eq "")
{
        die "entered lower limit  is empty\n";

}
#print "Marker : $marker Inputfile : $input UpperLimit : $uplimit LowLimit : $lowlimit\n";
open BUFF,"<$marker" or die "Can't open $marker : $!";
while($line = <BUFF>)
{
	chomp $line;
	@array = split(" ",$line);
  	$mark{$array[0]} = $array[1];	
}
$output = "$input"."_striped";
open(WRBUFF,">$output");
open BUFF,"<$input" or die "Can't open $input : $!";
#$line = <BUFF>;
#print WRBUFF $line;
#$line = <BUFF>;
#print WRBUFF $line;
while($line = <BUFF>)
{
        chomp $line;
        @array = split(" ",$line);
        if($mark{$array[0]} >= $lowlimit && $mark{$array[0]} < $uplimit)
	{
		print WRBUFF $line."\n";

	}
}

